package org.oslims.client.view.impl;

import org.oslims.client.view.ValidateResultsView;

import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.VerticalPanel;

public class ValidateResultsViewImpl extends BaseViewImpl implements ValidateResultsView {

	Tree requestTree = new Tree();

	Label header = new Label();

	Button validateSelectedAnalysis = new Button("Validate selected Analysis");

	Button validateSelectedSamples = new Button("Validate selected Samples");

	public ValidateResultsViewImpl() {
		DockLayoutPanel content = new DockLayoutPanel(Unit.PCT);
		content.setStyleName("mainContent");

		VerticalPanel headerPanel = new VerticalPanel();

		header.setStyleName("viewHeader");
		headerPanel.add(header);

		HorizontalPanel hpHeader = new HorizontalPanel();
		Label analysisListDescription = new Label("Select a Request: ");
		hpHeader.add(analysisListDescription);

		headerPanel.add(hpHeader);

		content.addNorth(headerPanel, 8);

		HorizontalPanel hpFooter = new HorizontalPanel();

		hpFooter.add(validateSelectedAnalysis);
		hpFooter.add(validateSelectedSamples);

		content.addSouth(hpFooter, 8);

		ScrollPanel tablePanel = new ScrollPanel();
		tablePanel.add(requestTree);

		content.add(tablePanel);

		initWidget(content);
	}

	@Override
	public Tree getRequestTree() {
		return requestTree;
	}

	@Override
	public Label getHeaderLabel() {
		return header;
	}

	@Override
	public HasClickHandlers getValidateSelectedAnalysisButton() {
		return validateSelectedAnalysis;
	}

	@Override
	public HasClickHandlers getValidateSelectedSamplesButton() {
		return validateSelectedSamples;
	}

}
